package com.zhangyusheng.easyecharts.component;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;


/**
 * TODO: 线性渐变色
 *
 * @author Michael zhang
 * @email zhangys_0217@sina.com
 * @since 2025年11月03日
 */

@Data
@Accessors(chain = true)
public class LinearGradient implements Serializable {
    private final static long serialVersionUID = 2L;
    /**
     * 固定值：明确这是线性渐变
     */
    private final String type = "linear";

    /**
     * 渐变坐标（相对或绝对）
     */
    private int x;
    private int y;
    private int x2;
    private int y2;

    /**
     * 默认使用相对坐标，因为这是最常用的
     */
    private boolean global = false;

    /**
     *  颜色断点
     */
    private List<ColorStop> colorStops;

    public LinearGradient(int x, int y, int x2, int y2, List<ColorStop> colorStops) {
        this.x = x;
        this.y = y;
        this.x2 = x2;
        this.y2 = y2;
        this.colorStops = colorStops;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getX2() {
        return x2;
    }

    public void setX2(int x2) {
        this.x2 = x2;
    }

    public int getY2() {
        return y2;
    }

    public void setY2(int y2) {
        this.y2 = y2;
    }

    public boolean isGlobal() {
        return global;
    }

    public void setGlobal(boolean global) {
        this.global = global;
    }

    public List<ColorStop> getColorStops() {
        return colorStops;
    }

    public void setColorStops(List<ColorStop> colorStops) {
        this.colorStops = colorStops;
    }
}
